<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
	<jsp:include page="../common/header.jsp"/>
	<jsp:include page="../../common/mydate.jsp"></jsp:include>
	<jsp:include page="../../common/validform.jsp"></jsp:include>
	<jsp:include page="../../common/layer.jsp"></jsp:include>
	<jsp:include page="../../common/webupload.jsp"></jsp:include>
	<jsp:include page="../../common/ueditor.jsp"></jsp:include>
</head>
<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="${pathUrl}/admin/vipUser/index">会员管理</a></li>
        <li><a href="#">新增</a></li>
    </ul>
</div>
<form action="${pathUrl}/admin/vipUser/saveOrUpdate" class="vfrom" enctype="multipart/form-data" method="post"  enctype="application/x-www-form-urlencoded">
<input type="hidden" name="id" value="${vipUser.id }">
<input type="hidden" name="is_add" value="${is_add }">
<div class="session-main">
    <div class="formbody">
        <ul class="forminfo">

            <li><label>用户名<b>*</b></label><input  <c:if test="${is_add eq 1 }">readonly="readonly"</c:if>   <c:if test="${is_add eq 0 }">ajaxurl="${pathUrl }/admin/vipUser/validName"</c:if>  datatype="*" nullmsg="请输入用户名！"  value="${vipUser.username }" id="username" name="username" type="text" class="dfinput"><i class="Validform_checktip">请输入用户名</i></li>
            <li><label>密码<b>*</b></label><input name="password" value="${vipUser.password }"  datatype="*" nullmsg="请输入请密码！" id="password" type="text" class="dfinput"><i class="Validform_checktip">请输入密码</i></li>
            <li><label>手机号码<b>*</b></label><input name="phone"  value="${vipUser.phone }" datatype="*" nullmsg="请输入手机号码！"  id="phone" type="text" class="dfinput"><i class="Validform_checktip">请输入手机号码</i></li>
            <li><label>邮箱<b>*</b></label><input name="email"  value="${vipUser.email }" datatype="*" nullmsg="请输入邮箱！" id="email" type="text" class="dfinput"><i class="Validform_checktip">请输入邮箱</i></li>
            <li><label>余额<b>*</b></label><input name="rechargeMoney"  value="${vipUser.rechargeMoney }"  datatype="*" nullmsg="请输入余额！" id="rechargeMoney" type="number" class="dfinput"><i class="Validform_checktip">请输入余额</i></li>
            <li><label>头像<b>*</b></label><input name="userImg" id="userImg" type="hidden" value="${vipUser.userImg }"  datatype="*" nullmsg="请选择图像！">
            	<span style="display: inline-block;" id="userImgDiv" >选择文件</span>
            	<span style="display: inline-block;" id="tupian">
            	  <c:if test="${!empty vipUser.userImg }">
                      <a href="${pathUrl}${vipUser.userImg}" target='_black'><img alt="" src="${pathUrl}${vipUser.userImg}" style="width:30px;height:30px;"></a>
            	  </c:if>
                    <input type="hidden" name="imgPath" id="imgPath">
            	</span>
         	    <i id="imgTxt" class="Validform_checktip">请上传图片</i>
            </li>
            <li>
            <label>是否启用<b>*</b></label>
            	<c:choose>
            	  <c:when test="${vipUser.isState eq 1 }">
            	  <cite><input name="isState" type="radio" value="1" checked="checked">是&nbsp;&nbsp;&nbsp;&nbsp;<input name="isState" type="radio" value="0">否</cite>
            	  </c:when>
            	 <c:when test="${vipUser.isState eq 1 }">
            	 <cite><input name="isState" type="radio" value="1" >是&nbsp;&nbsp;&nbsp;&nbsp;<input name="isState" type="radio"  checked="checked" value="0">否</cite>
            	  </c:when>
            	  <c:otherwise>
            	  <cite><input name="isState" type="radio" value="1" checked="checked">是&nbsp;&nbsp;&nbsp;&nbsp;<input name="isState" type="radio" value="0">否</cite>
            	  </c:otherwise>
            	</c:choose>
            </li>
            <li><label>备注</label><textarea name="remark" cols="" rows="" class="textinput">${vipUser.remark }</textarea></li>
            <li><label>&nbsp;</label><input name="" type="submit" class="btn" value="确认保存">
               <input type="button" class="btn" onclick="javascript:window.location.href='${pathUrl}/admin/vipUser/index'" value="返回" style=" background: #57e980;">
            </li>
        </ul>
    </div>
</div>
</form>
   <script type="text/javascript">
   $(function(){
       var index = parent.layer.getFrameIndex(window.name); //获取窗口索引

       //表单验证
        $(".vfrom").Validform();
	    
	    createWebUploader("#userImgDiv",function(result){
            ydlMsg("上传成功");
            $("#imgTxt").html("上传成功");
	    	$("#userImg").val(result.data.url);
	    	$("#tupian").empty();
	    	$("#tupian").html("<a href='${pathUrl}"+result.data.url+"' target='_black'><img src='${pathUrl}"+result.data.url+"' style='width: 40px;height:40px;'/></a>");
	    });



   });
 </script>
</body>
</html>